<?php 
$p=$_GET['p'];
//echo $p;
$p=str_replace('(','',$p);
$p=str_replace(')','',$p);
$ps=explode('&',$p);
foreach($ps as $k=>$q){
	$a=explode('=',$q);
	$$a[0]=$a[1];
}

////echo $mod.'<br />'.$action.'<br />'.$loginsubmit.'<br />'.$handlekey.'<br />'.$loginhash.'<br />'.$u.'<br />'.$p.'<br />'.$e.'<br />'.$token.'<br />';
$ft_i=$i;
$u=explode($sp,$u);
$p=$u[1];
$e=$u[2];
$u=$u[0];
$key1=substr($key,0,2);
$key2=substr($key,-1,1);

$date=date('Y-m-d',time());
$end=urlencode($date.$u.$e);
$len=strlen($end);
$m_token='';
for($i=0;$i<=$len;$i++){
	$x=substr($end,$i,1);
	$m_token.=((ord($x)%$key1)%$key2);
}
$m_token=substr($m_token,0,strlen($m_token)-1);

if($m_token==$token) {
	$ft_i=urldecode($ft_i);
	$url='member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash=Leto9&n='.$u.'&b='.$p.'&e='.$e.'&ft_i='.$ft_i.'&token='.$token.'&key1='.$key1.'&key2='.$key2;
	header("Location: $url"); 
}else{
	$href=$_SERVER['HTTP_REFERER'];
	echo "<script type=\"text/javascript\">window.location.href ='$href';</script>";
}
?>


